/*
	YoghurtGum - 2D Game Engine

	Copyright 2009-2010 Quinten Lansu
	
	Licensed under the Apache License, Version 2.0 (the "License"); you may not 
	use this file except in compliance with the License. You may obtain a copy 
	of the License at 
		
		http://www.apache.org/licenses/LICENSE-2.0 
		
	Unless required by applicable law or agreed to in writing, software 
	distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
	WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
	License for the specific language governing permissions and limitations 
	under the License. 
*/

#ifndef _YGENGINE_H_
#define _YGENGINE_H_

#include "YGFunctions.h"
#include "YGDevice.h"
#include "YGScene.h"
#include "YGInput.h"
#include "YGLog.h"
#include "YGError.h"

namespace YoghurtGum
{


#ifdef OLDCODE

	class Scene;

	class Game
	{

	public:

		virtual void Init() = 0;
		virtual void Update() = 0;
		virtual void Render() = 0;
		static Game* Create();
		Scene* scene_current;

	}; // class Game

	struct Engine
	{
		enum Setting
		{
			YGS_WINDOWTITLE,
			YGS_ICON,
		};
		
		static void Run();

		static int SetSetting(Setting a_Setting, const char* a_Value);

		static void Quit();

		static bool s_Running;
		static Game* s_Game;

	private:

		static void Init();

		static void Tick();
		static bool PreRender();
		static void Render();
		static void ShutDown();

		static unsigned long s_PhysicsStart, s_PhysicsCurrent;
		static float s_PhysicsTime;

#ifdef YG_LOG_FPS

		static unsigned long start, end;
		static int counter;

#endif

		inline static void CheckExit()
		{
			if (Device::gameover || Error::fatalerror) { s_Running = false; }
		}
		
	}; // struct Engine

#endif

};

#endif
